
//
//  YYYWebViewController.swift
//  HotNews
//
//  Created by YYY on 2017/11/7.
//  Copyright © 2017年 成品家（北京）网路科技有限公司. All rights reserved.
//

import UIKit
import SVProgressHUD

class YYYWebViewController: YYYBaseViewController {

    //浏览视图
    private lazy var myWebView = UIWebView(frame: CGRect(x: 0, y: 64, width: kDeviceWidth, height: kDeviceHeight-64))
    
    override func viewDidLoad()
    {
        super.viewDidLoad()
        customNavigationItem.title = "网页"
        //设置代理
        myWebView.delegate = self
        view.addSubview(myWebView)
        myWebView.backgroundColor = UIColor.white
    }
    
    var urlString: String?
    {
        didSet
        {
            guard let urlString = urlString,
                  let url = URL(string: urlString) else {
                return
            }
            myWebView.loadRequest(URLRequest(url: url))
        }
    }
}
extension YYYWebViewController: UIWebViewDelegate
{
    func webViewDidStartLoad(_ webView: UIWebView)
    {
        SVProgressHUD.show()
        
    }
    func webViewDidFinishLoad(_ webView: UIWebView)
    {
        SVProgressHUD.dismiss()
    }
}
